import request from '@/utils/request'
import { makeFormData } from '@/utils/util'

const auditApi = {
  config: 'web/course_audit/get_auditor_setting',
  submit: 'web/course_audit/add_auditor'
}

export function getAuditConfig (data = {}) {
  return request({
    url: auditApi.config,
    method: 'post',
    data: makeFormData(data)
  })
}

export function auditSubmit (params = {}, data = {}) {
  return request({
    url: auditApi.submit,
    method: 'post',
    params,
    data: makeFormData(data)
  })
}

const scheduleApi = {
  nurseryClasses: 'web/nursery_schedule/teacher_classes_list',
  nurserySchule: 'web/nursery_schedule/teacher_detail',
  nurserySchuleAdd: 'web/nursery_schedule/add',
  nurserySchuleUpdate: 'web/nursery_schedule/update',
  nurseryCheck: 'web/nursery_schedule/get_schedule_check',
  course: 'web/course_early/course_page_by_type'
}

export function getNurseryClasses (params = {}) {
  return request({
    url: scheduleApi.nurseryClasses,
    method: 'post',
    params
  })
}

export function getNurseryCheck (data = {}) {
  return request({
    url: scheduleApi.nurseryCheck,
    method: 'post',
    data: makeFormData(data)
  })
}

export function getNurserySchule (data = {}) {
  return request({
    url: scheduleApi.nurserySchule,
    method: 'post',
    data: makeFormData(data)
  })
}

export function nurserySchuleSubmit (data = {}, type) {
  return request({
    url: scheduleApi[type === 'add' ? 'nurserySchuleAdd' : 'nurserySchuleUpdate'],
    method: 'post',
    data: makeFormData(data)
  })
}
